<?php
require ('include/connect.php');
require ('include/db_sql.php');
require ('include/functions.php');
$lur = islogin();
$loginin = $lur['username'];
$rnd = $lur['rnd'];
$link = db_connect();
$dblink = new mysqlquery();
$mydbname = RepPostVar($_GET['mydbname']);
if (empty($mydbname)) {
    printerror("NotChangeDb", "history.go(-1)");
}
// 选择数据库
$udb = $dblink->query("use `" . $mydbname . "`");
// 存放目录
$mypath = $mydbname . "_" . date("YmdHis");
if ($phpsafemod) {
    $mypath = "safemod";
}
// 导入设置
if (isset($_GET['savefilename'])) {
    $loadfile = RepPostVar($_GET['savefilename']);
} else {
    $loadfile = '';
}

if (strstr($loadfile, '.') || strstr($loadfile, '/') || strstr($loadfile, "\\")) {
    $loadfile = '';
}
if (empty($loadfile)) {
    $loadfile = 'def';
}
$loadfile = 'setsave/' . $loadfile;
@include ($loadfile);
if ($dmypath) {
    $mypath = $dmypath;
}
// 查询
if (isset($_GET['keyboard'])) {
    $keyboard = RepPostVar($_GET['keyboard']);
} else {
    $keyboard = '';
}
if (empty($keyboard)) {
    $keyboard = $dkeyboard;
    if (empty($keyboard)) {
        $keyboard = $baktbpre;
    }
}
$and = "";
if ($keyboard) {
    $and = " LIKE '%$keyboard%'";
}

$sql = $dblink->query("SHOW TABLE STATUS" . $and);

require LoadAdminTemp('change_table.php');
db_close();
$dblink = null;